package com.adcc.swingui.demo.toolbar;

import java.awt.Container;
import java.util.List;

import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JMenuItem;

import com.adcc.swingui.base.DefaultToolBar;
import com.jidesoft.swing.JideSplitButton;

/**
 * 扇区
 * @author charlie
 *
 */
public class SectorToolBut extends DefaultToolBar {
	private JideSplitButton but;
	
	private JCheckBoxMenuItem hiItem;
	private JCheckBoxMenuItem lowItem;
	private JCheckBoxMenuItem inItem;
	private JCheckBoxMenuItem lowinItem;
	private JCheckBoxMenuItem item;

	public SectorToolBut(Container container) {
		super(container);
	}

	@Override
	protected JComponent build() {
		but = createSplitButton(new ImageIcon("res/images/sector.png"));
		but.setToolTipText("扇区");
		hiItem=createCheckBoxMenuItem("HIGHT", "高空扇区");
		addChildItem(but, hiItem, null);
		lowItem=createCheckBoxMenuItem("LOW", "低空扇区");
		addChildItem(but, lowItem, null);
		inItem=createCheckBoxMenuItem("PUTIN", "进近扇区");
		addChildItem(but, inItem, null);
		lowinItem=createCheckBoxMenuItem("LOWIN", "低空扇区");
		addChildItem(but, lowinItem, null);
		return but;
	}

	@Override
	protected void addMouseListener() {
		//这里填写对应响应事件
		JideSplitButton but = (JideSplitButton)sourceComp;
		//状态设置（业务填写）
		if(but.isSelected()) {
			but.setSelected(false);
		} else {
			but.setSelected(true);
		}
		//获取选中子菜单
		List<String> list = getSelectedItemName((JMenuItem[])but.getMenuComponents());
	}

	@Override
	protected void i18n() {
		// TODO Auto-generated method stub
		
	}
}
